﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using DatabaseSchemaReader;
using DatabaseSchemaReader.DataSchema;

namespace Happy.Edge.DatabaseSchemaReader.Extentions
{
    public static class DatabaseConstraintExtentions
    {
        public static object ToDynamic(this DatabaseConstraint constraint)
        {
            return new
            {
                columns = constraint.Columns,
                constraintType = constraint.ConstraintType,
                deleteRule = constraint.DeleteRule,
                expression = constraint.Expression,
                name = constraint.Name,
                refersToConstraint = constraint.RefersToConstraint,
                refersToTable = constraint.RefersToTable,
                tableName = constraint.TableName,
                updateRule = constraint.UpdateRule,
            };
        }
    }
}
